
package cb.com.etcdemo.API;

import android.util.Log;


import java.util.HashMap;
import java.util.Map;

import cb.com.etcdemo.http.Okhttp;
import cb.com.etcdemo.util.JSONUtils;


/**
 * Created by cb on 2018/4/7.
 */

public class API {
    public static final String Base = "http://134.175.121.17:16200";




    /**
     * 登录
     *
     * @param type
     * @param queryCriteria
     * @param handler
     */
    public static void listDeviceStateOnLine(int type , String queryCriteria, Okhttp.Objectcallback handler) {

        try {
            Okhttp.get(Base + "type="+type+"&queryCriteria="+queryCriteria, null, handler);
            Log.e("URL",Base + "type="+type+"&queryCriteria="+queryCriteria);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
//    http://134.175.121.17:16200/web/deviceState/listDeviceStateOnLineByPage?currentPage=1&type=1&queryCriteria=52000559

    public static void getxinxi(  String queryCriteria, Okhttp.Objectcallback handler) {

        Okhttp.get(Base + "/web/deviceState/listDeviceStateOnLineByPage?currentPage=1&type=4&queryCriteria="+queryCriteria, null, handler);

    }
    /**
     * 账户相关 登录 1
     *
     * @para
     */
    public static void Login(String username, String password, Okhttp.Objectcallback handler) {
        Map<String, String> map = new HashMap<>();
        map.put("username", username);
        map.put("password", password);
        String s = JSONUtils.mapToJson(map);
        Log.e("888", s);
        Log.e("888", Base + "web/user/login");
        Okhttp.post(Base + "/web/user/login", map, handler);

    }
    /**
     * 账户相关 登录 1
     *
     * @para
     */
    public static void Dijiao(String stationName,
                             String vehicleCode,
                             String vehicleId,
                             String hostCode,
                             String hostVersion,
                             String slaveCode,
                             String slaveVersion,
                             String serialVersion,
                             String fgboxVersion,
                              String  repairResult,
                             String repariRemark,
                             String opUser,
                             String opDate,

                             Okhttp.Objectcallback handler) {
        Map<String, String> map = new HashMap<>();
        map.put("stationName", stationName);
        map.put("vehicleCode", vehicleCode);
        map.put("vehicleId", vehicleId);
        map.put("hostCode", hostCode);
        map.put("hostVersion", hostVersion);
        map.put("slaveCode", slaveCode);
        map.put("slaveVersion", slaveVersion);
        map.put("serialVersion", serialVersion);

        map.put("repairResult", repairResult);
        map.put("fgboxVersion", fgboxVersion);
        map.put("repariRemark", repariRemark);
        map.put("opUser", opUser);
        map.put("opDate", opDate);



        String s = JSONUtils.mapToJson(map);
        Log.e("888", s);
        Log.e("888", Base + "web/deviceMtain/record");
        Okhttp.post(Base + "/web/deviceMtain/record", map, handler);

    }


}
